; ModuleID = 'd4dag.bc'
source_filename = "d4dag.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

%struct.d4d__maing = type { i8* (i64)*, void (i8*)* }

@d4d__main = internal global %struct.d4d__maing* null, align 8

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @d4d_version() #0 {
  ret i32 10
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @d4d_init(i8* (i64)*, void (i8*)*) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i8* (i64)*, align 8
  %5 = alloca void (i8*)*, align 8
  store i8* (i64)* %0, i8* (i64)** %4, align 8
  store void (i8*)* %1, void (i8*)** %5, align 8
  %6 = load i8* (i64)*, i8* (i64)** %4, align 8
  %7 = icmp ne i8* (i64)* %6, null
  br i1 %7, label %9, label %8

; <label>:8:                                      ; preds = %2
  store i32 -1, i32* %3, align 4
  br label %29

; <label>:9:                                      ; preds = %2
  %10 = load void (i8*)*, void (i8*)** %5, align 8
  %11 = icmp ne void (i8*)* %10, null
  br i1 %11, label %13, label %12

; <label>:12:                                     ; preds = %9
  store i32 -1, i32* %3, align 4
  br label %29

; <label>:13:                                     ; preds = %9
  %14 = load i8* (i64)*, i8* (i64)** %4, align 8
  %15 = call i8* %14(i64 16)
  %16 = bitcast i8* %15 to %struct.d4d__maing*
  store %struct.d4d__maing* %16, %struct.d4d__maing** @d4d__main, align 8
  %17 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %18 = icmp eq %struct.d4d__maing* %17, null
  br i1 %18, label %19, label %20

; <label>:19:                                     ; preds = %13
  store i32 -2, i32* %3, align 4
  br label %29

; <label>:20:                                     ; preds = %13
  %21 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %22 = bitcast %struct.d4d__maing* %21 to i8*
  call void @d4d__memzero(i8* %22, i64 16)
  %23 = load i8* (i64)*, i8* (i64)** %4, align 8
  %24 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %25 = getelementptr inbounds %struct.d4d__maing, %struct.d4d__maing* %24, i32 0, i32 0
  store i8* (i64)* %23, i8* (i64)** %25, align 8
  %26 = load void (i8*)*, void (i8*)** %5, align 8
  %27 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %28 = getelementptr inbounds %struct.d4d__maing, %struct.d4d__maing* %27, i32 0, i32 1
  store void (i8*)* %26, void (i8*)** %28, align 8
  store i32 0, i32* %3, align 4
  br label %29

; <label>:29:                                     ; preds = %20, %19, %12, %8
  %30 = load i32, i32* %3, align 4
  ret i32 %30
}

; Function Attrs: noinline nounwind optnone uwtable
define internal void @d4d__memzero(i8*, i64) #0 {
  %3 = alloca i8*, align 8
  %4 = alloca i64, align 8
  %5 = alloca i8*, align 8
  store i8* %0, i8** %3, align 8
  store i64 %1, i64* %4, align 8
  store i8* null, i8** %5, align 8
  %6 = load i8*, i8** %3, align 8
  store i8* %6, i8** %5, align 8
  br label %7

; <label>:7:                                      ; preds = %10, %2
  %8 = load i64, i64* %4, align 8
  %9 = icmp ne i64 %8, 0
  br i1 %9, label %10, label %16

; <label>:10:                                     ; preds = %7
  %11 = load i8*, i8** %5, align 8
  store i8 0, i8* %11, align 1
  %12 = load i8*, i8** %5, align 8
  %13 = getelementptr inbounds i8, i8* %12, i32 1
  store i8* %13, i8** %5, align 8
  %14 = load i64, i64* %4, align 8
  %15 = add i64 %14, -1
  store i64 %15, i64* %4, align 8
  br label %7

; <label>:16:                                     ; preds = %7
  ret void
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @d4d_deinit() #0 {
  %1 = alloca i32, align 4
  %2 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %3 = icmp eq %struct.d4d__maing* %2, null
  br i1 %3, label %4, label %5

; <label>:4:                                      ; preds = %0
  store i32 0, i32* %1, align 4
  br label %11

; <label>:5:                                      ; preds = %0
  %6 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %7 = getelementptr inbounds %struct.d4d__maing, %struct.d4d__maing* %6, i32 0, i32 1
  %8 = load void (i8*)*, void (i8*)** %7, align 8
  %9 = load %struct.d4d__maing*, %struct.d4d__maing** @d4d__main, align 8
  %10 = bitcast %struct.d4d__maing* %9 to i8*
  call void %8(i8* %10)
  store %struct.d4d__maing* null, %struct.d4d__maing** @d4d__main, align 8
  store i32 0, i32* %1, align 4
  br label %11

; <label>:11:                                     ; preds = %5, %4
  %12 = load i32, i32* %1, align 4
  ret i32 %12
}

attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 8.0.1-3~bpo10+1 (tags/RELEASE_801/final)"}

